1. Field of the Invention
The invention of the present patent application relates to a linker which links a plurality of intermediate-language programs, obtained by conversion by a compiler of so-called source programs written in a source language, and more specifically, for example, links programs in which absolute addresses at runtime are not determined and general-purpose library programs, to create for example an object program in which absolute addresses at runtime are determined. However, the above-described determination of absolute addresses at runtime is merely one example, to which the present invention is not limited.
The invention of the present patent application relates in particular to a linker for programs written in for example the Java (R) language (in this specification, an “(R)” appended to a product name indicates that the product name is a registered trademark) which is executed on portable equipment and various other devices with significant limitations on the memory size of the execution environment. However, this also is merely one example, to which the present invention is not limited.
2. Description of the Related Art
In the prior art, linkers which link a plurality of programs written in the Java (R) language or C language to create an executable program have, for example, been described in Japanese Patent Laid-open No. 10-069376 and in the national publication of a translation of the international patent application 2000-514584. For example, in a conventional Java (R) execution environment, the Java (R) source code for an application program is converted into bytecodes which are an intermediate language, and stored as files in class units.
When the application is started, necessary portions from these class files are loaded, and by linking these an executable program is created. This method is called a runtime linking method. A program using this method and the flow of the processing are shown in FIG. 12. In the example of FIG. 12, the programs for class A, class B, class X, and class Y, written in an intermediate language, are stored on the server 909. In conventional runtime linking methods, these four programs are loaded and stored in advance on the terminal device 901.
For example, suppose that an application program 902 is created by linking programs from class A, class B and class X among the classes. When the application program 902 is started on the terminal device 901, the linker (i.e., the program linking program) performs runtime linking. Specifically, the linker creates and supplies for execution the application program 902 by linking programs from class A, class B, and class X.
Further, suppose that programs from class A, class B, and class Y among the classes can be linked to create an application program 903. When this application program 903 is started on a terminal device 901, the linker performs runtime linking. That is, the linker creates and provides for execution the application program 903 by linking programs from class A, class B, and class Y.
On the other hand, in for example a conventional C language execution environment, a source program is converted into an object program by compiling, and at the same time the necessary libraries are linked in advance to create and store an executable file. When the application is started, the executable file is loaded and executed.
This method is called advance linking. A program employing this method and the flow of the processing are shown in FIG. 13. In the example of FIG. 13, programs from class A, class B, class X, and class Y, written in an intermediate language, are for example stored on a server 929. These programs are linked in advance by the server 929, to create the application program 922 and the application program 923.
The terminal device 921 loads and stores these application programs 922 and 923. When either the application program 922 or the application program 923 is started, the terminal device 921 can immediately execute the program.
In the runtime linking method shown in FIG. 12, one intermediate-language program is loaded and stored by the terminal device 901 from each of class A, class B, class X, and class Y. Hence there is no need for redundant storage of libraries, and the required storage space can be reduced. This is an important advance for equipment, such as portable equipment, in which the capacity of the storage portion is limited. However, the runtime linking method entails linking after the application is started, so that there is the drawback that considerable time is required from application startup until actual execution.
In contrast, the advance linking method shown in FIG. 13 performs linking in advance to create an executable file, so that when the application is started immediate execution is possible. This is a major advantage of the advance linking method. On the other hand, because linking is performed in advance, the terminal device 921 must redundantly store class A and class B, which are libraries used in common by the application program 922 and by the application program 923. This is a major disadvantage for equipment, such as portable equipment, in which the capacity of the storage portion is limited.